<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="${ctx }/style/css_member.css" rel="stylesheet" type="text/css" />
<link type="text/css" href="${ctx }/style/smoothness/jquery-ui-1.7.3.custom.css" rel="stylesheet" />
<script type="text/javascript" src="${ctx }/js/common.js"></script>
<script src="${ctx }/js/artDialog.js?skin=gray"></script>
<script src="${ctx }/js/artDialog.iframeTools.js"></script>
<script type="text/javascript" src="${ctx }/js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="${ctx }/js/jquery-ui-1.7.3.custom.min.js"></script>
<script language="javascript" type="text/javascript" src="${ctx }/js/My97DatePicker/WdatePicker.js"></script>
<title>添加拍品</title>

<style type="text/css">
.table_content td {font-family: 宋体;font-size: 13px;padding: 10px 5px;}
</style>

<script type="text/javascript">

function checkForm(){

	var title = $.trim($("#title").val());
	if (title == "") {
		$("#title").focus();
		alert("请填写主题。");
		return false;
	}

	var beginPrice = $("#beginPrice").val();
	if (!isNumber(beginPrice)) {
		$("#beginPrice").val("");
		$("#beginPrice").focus();
		alert("起拍价填写不正确。");
		return false;
	}

	var goods_id = $("#goods_id").val();
	if( goods_id == ""){
		alert("请选择要上架拍卖的作品。");
		return false;
	}

	var beginTime = $("#beginTime").val();
	if( beginTime == ""){
		alert("请填写拍卖起始时间。");
		return false;
	}
	
	var endTime = $("#endTime").val();
	if( endTime == ""){
		alert("请填写拍卖结束时间。");
		return false;
	}

	if(beginTime > endTime){
		alert("起拍时间和结束时间填写不合理，起拍时间必须小于结束时间。");
		return false;
	}

	$("#bidForm").submit();
}

$(function(){

	$("#choose_button").click(function(){
		art.dialog.open('${ctx}/back/goodsAction!queryGoods.do',{title:'作品库',width:750,height:550},false);
    });

    $("#add_button").click(function(){
		art.dialog.open('${ctx}/painting/addPrepare.do?bidFlag=1',{title:'发布作品',width:820,height:550,lock:true},false);
    });

    $('#tabs').tabs({selected:1});
});

</script>
</head>

<body>

<!-- 页面头部  -->
<jsp:include page="/commons/head_member.jsp"></jsp:include>
<div id="main">

		<!-- Tabs -->
		<div id="tabs">
			<ul>
				<li style="font-weight: bold;font-size: 12px"><a href="#hiddenDiv" onclick="javascript:location.href=${ctx}/bid/bidAction!list.do">拍品列表</a></li>
				<li style="font-weight: bold;font-size: 12px"><a href="#tabs-1">新增拍品</a></li>
			</ul>
			<div id="hiddenDiv"></div>
			<div id="tabs-1">
				<form action="${ctx}/bid/bidAction!save.do" method="post" id="bidForm" name="bidForm" enctype="multipart/form-data">
					<table width="910" cellspacing="0" cellpadding="0" align="center" class="table_content">
				              <tr>
				                <td align="right"><span class="style15">*</span>作品：</td>
				                <td><input type="text" value="${bid.goods.name }" id="goods_name" readonly="readonly"/>&nbsp;&nbsp;
				                	<input type="button" value="选择作品" style="padding: 5px;" id="choose_button"/>&nbsp;&nbsp;
				                	<input type="button" value="新增作品" style="padding: 5px;" id="add_button"/>
				                </td>
				              </tr>
				              <tr>
				                <td align="right"><span class="style15">*</span>拍品主题：</td>
				                <td><input name="bid.title" type="text" size="30" id="title" maxlength="50"></td>
				              </tr>
				              <tr>
				                <td align="right"><span class="style15">*</span>起拍价：</td>
				                <td><input name="bid.beginPrice" type="text" size="30" id="beginPrice" maxlength="30"></td>
				              </tr>
				              <tr>
				                <td align="right"><span class="style15">*</span>证书：</td>
				                <td><input name="myFile" type="file"  id="myFile"></td>
				              </tr>
				              <tr>
				                <td align="right"><span class="style15">*</span>起拍时间：</td>
				                <td><input name="bid.beginTime" type="text" size="30" id="beginTime" onClick="WdatePicker({startDate:'%y-%M-%d 00:00:00',dateFmt:'yyyy-MM-dd HH:mm',alwaysUseStartDate:true})"></td>
				              </tr>
				              <tr>
				                <td align="right"><span class="style15">*</span>结束时间：</td>
				                <td><input name="bid.endTime" type="text" size="30" id="endTime" onClick="WdatePicker({startDate:'%y-%M-%d 00:00:00',dateFmt:'yyyy-MM-dd HH:mm',alwaysUseStartDate:true})"></td>
				              </tr>
				              <tr>
				                <td width="128">
				                	<input type="hidden" name="bid.goods_id" value="" id="goods_id"/>
				                </td>
				                <td class="nw12a">
				                	<input type="button" value="保存" style="cursor: pointer ;padding: 5px 8px;" onclick="checkForm()">
				                </td>
				              </tr>
				  </table>
				</form>
			</div>
	</div>
</div>

<jsp:include page="/commons/foot_member.jsp"></jsp:include>

</body>
</html>